<?php

class ProcessLogger {

    private $log = array();
    private $errors_count = 0;
    
    public function addLog($class, $text) {
        if($class == 'error') $this->errors_count++;
        $this->log[] = array('class' => $class, 'text' => $text, 'date' => date('r'), 'time' => time());
        return true;
    }

    public function renderHtml() {
        sfProjectConfiguration::getActive()->loadHelpers('Partial');
        return get_partial(
                'global/process_log',
                array(
                    'log' => $this->log));
    }

    public function getErrorsCount() {
        return $this->errors_count;
    }

    public function emailLog($email = null) {
        return true;
    }

}